package com.acane.instagram;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;
import java.io.File;

@SpringBootApplication
public class InstagramApplication {

    public static void main(String[] args) {
        SpringApplication.run(InstagramApplication.class, args);
    }
    @PostConstruct
    public void init() {
        // 创建 uploads 目录
        String uploadDir = "uploads/";
        File uploadDirectory = new File(uploadDir);
        if (!uploadDirectory.exists()) {
            boolean created = uploadDirectory.mkdirs();
            if (created) {
                System.out.println("Upload directory created: " + uploadDir);
            } else {
                System.out.println("Failed to create upload directory: " + uploadDir);
            }
        } else {
            System.out.println("Upload directory already exists: " + uploadDir);
        }
    }
}
